<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>typeof返回数据类型</title>
</head>
<body>
    <script>
        var a = 10;
        var b = 10.0;
        var c = "abcd";
        var d = true;
        var e = {};
        //typeof:判断数据类型
        document.write(typeof a,"<br>");//number数字
        document.write(typeof b,"<br>");//number数字
        document.write(typeof c,"<br>");//string 字符串
        document.write(typeof d,"<br>");//boolean 布尔类型
        document.write(typeof e,"<br>");//object(可以返回object的有很多种情况)

        document.write(typeof [],"<br>")//返回object，具体来说是数组

        document.write(typeof null,"<br>");//object
        document.write(typeof undefined,"<br>");//undefined

        //null一般代表对象为"没有"
        //undefined一般代表数值为"没有"
    </script>
</body>
</html>